//
//  AppDelegate.m
//  Weibo
//
//  Created by taoshanchang on 15/1/15.
//  Copyright (c) 2015年 taoshanchang. All rights reserved.
//

#import "AppDelegate.h"
#import "MainViewController.h"
#import "LeftViewController.h"
#import "RightViewController.h"
#import "WeiboSDK.h"
#import "CONSTS.h"
#import "ThemeManager.h"



@interface WBBaseRequest ()
- (void)debugPrint;
@end

@interface WBBaseResponse ()
- (void)debugPrint;
@end

@interface AppDelegate ()

@end

@implementation AppDelegate


-(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{
    return [WeiboSDK handleOpenURL:url delegate:_mainViewController];
}



-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{
    return [WeiboSDK handleOpenURL:url delegate:_mainViewController];
}


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    //绑定微博
    [WeiboSDK enableDebugMode:YES];
    [WeiboSDK registerApp:kAppKey];

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    
    [self setThemeName];
    
    _mainViewController = [[MainViewController alloc] init];
    
    LeftViewController *leftController = [[LeftViewController alloc] init];
    RightViewController *rightController = [[RightViewController alloc] init];
    
    _menuController = [[DDMenuController alloc] initWithRootViewController:_mainViewController];
    _menuController.leftViewController = leftController;
    _menuController.rightViewController = rightController;
    
    self.window.rootViewController = _menuController;

    return YES;
}

-(void)setThemeName{
    NSString *themeName = [[NSUserDefaults standardUserDefaults] objectForKey:kThemeName];
    [[ThemeManager sharedInstance ] setThemeName:themeName];
}



@end
